﻿using System;
using log4net.Appender;
using log4net.Core;
using System.Diagnostics;

namespace NHTrace.Appenders
{
  public class DebugRemotingAppender : RemotingAppender
  {
    private bool debuggerAttached;

    public DebugRemotingAppender() : base()
    {
      debuggerAttached = Debugger.IsAttached;
    }

    public override void ActivateOptions()
    {
      if (debuggerAttached)
        base.ActivateOptions();
    }

    protected override void OnClose()
    {
      if (debuggerAttached)
        base.OnClose();
    }

    protected override void SendBuffer(LoggingEvent[] events)
    {
      if (debuggerAttached)
        base.SendBuffer(events);
    }
  }
}
